package com.pnnd.utils;

import sun.reflect.generics.reflectiveObjects.NotImplementedException;

import java.util.ArrayList;
import java.util.List;

public class CollectionUtils {

    private CollectionUtils(){

    }

    public static <E> List<E> readonly(List<E> source){
        return new ArrayList<E>(source){

            @Override
            public E set(int index, E element) {
                throw new NotImplementedException();
            }

            @Override
            public boolean add(E e) {
                throw new NotImplementedException();
            }

            @Override
            public void add(int index, E element) {
                throw new NotImplementedException();
            }

            @Override
            public E remove(int index) {
                throw new NotImplementedException();
            }

            @Override
            public boolean remove(Object o) {
                throw new NotImplementedException();
            }
        };
    }

}
